home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:RHHandlerDb="http://ehelp.com/RHHandlerDb" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" exclude-result-prefixes="msxsl RHHandlerDb html">
-
- <xsl:output method="xml" cdata-section-elements="programlisting" encoding="ISO-8859-1" indent="yes"/>
-
- <xsl:param name="rhc.not.to.chunk.longdesc" select="1" />
-
- <msxsl:script language="JScript" implements-prefix="RHHandlerDb">
- function StrToNode( str )
- {
- var objFTDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
- objFTDoc.loadXML(str) ;
- return objFTDoc.documentElement;
- }
- </msxsl:script>
-
- <xsl:template match="comment()">
- <xsl:choose>
- <xsl:when test="substring(.,1,16) = '[RH.HTML.OBJECT]'">
- <xsl:copy-of select="RHHandlerDb:StrToNode(substring(.,17))" />
- </xsl:when>
- <xsl:when test="substring(.,1,16) = '[RH.HTML.RML_10]'">
- <xsl:copy-of select="RHHandlerDb:StrToNode(substring(.,17))" />
- </xsl:when>
- <!--xsl:when test="substring(.,1,7) = '<ROBOML'">
- <xsl:copy-of select="RHHandlerDb:StrToNode(string(.))" />
- </xsl:when-->
- <xsl:otherwise>
- <xsl:copy />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="@role">
- <xsl:choose>
- <xsl:when test="substring(.,1,4) = 'RHC.'">
- <xsl:call-template name="RHC.Role">
- <xsl:with-param name="rolestr" select="." />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="/article[substring(@role,1,4)='RHC.' and substring-after(@role, '\') = 'html']" priority = "1">
- <xsl:variable name="toc.params">
- <xsl:call-template name="find.path.params">
- <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:apply-templates/>
- <xsl:call-template name="process.chunk.footnotes"/>
- </xsl:template>
-
- <xsl:template match="section[substring(@role,1,4)='RHC.' and substring-after(@role, '\') = 'div']">
- <div xmlns="http://www.w3.org/1999/xhtml">
- <xsl:if test="@id">
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@role"/>
- <xsl:apply-templates/>
- </div>
- </xsl:template>
-
- <xsl:template match="section[substring(@role,1,4)='RHC.' and substring-after(@role, '\') = 'noscript']">
- <noscript xmlns="http://www.w3.org/1999/xhtml">
- <xsl:if test="@id">
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@role"/>
- <xsl:apply-templates/>
- </noscript>
- </xsl:template>
-
- <xsl:template match="citation[substring(@role,1,4)='RHC.']">
- <cite xmlns="http://www.w3.org/1999/xhtml">
- <xsl:if test="@id">
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@role"/>
- <xsl:apply-templates/>
- </cite>
- </xsl:template>
-
- <xsl:template match="quote[substring(@role,1,4)='RHC.']">
- <q xmlns="http://www.w3.org/1999/xhtml">
- <xsl:if test="@id">
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@role"/>
- <xsl:apply-templates/>
- </q>
- </xsl:template>
-
- <xsl:template match="phrase[substring(@role,1,4)='RHC.']">
- <xsl:call-template name="convertToStoredElement">
- <xsl:with-param name="defaultElement" select="'span'" />
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match="emphasis[substring(@role,1,4)='RHC.']">
- <xsl:call-template name="convertToStoredElement">
- <xsl:with-param name="defaultElement" select="'em'" />
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template match="literal[substring(@role,1,4)='RHC.']">
- <xsl:call-template name="convertToStoredElement">
- <xsl:with-param name="defaultElement" select="'tt'" />
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="convertToStoredElement">
- <xsl:param name="defaultElement" select="''" />
-
- <xsl:if test="substring(@role, 1, 4) = 'RHC.'">
- <xsl:variable name="original_tag" select="normalize-space(substring-after(@role, '\'))" />
- <xsl:variable name="elementName">
- <xsl:choose>
- <xsl:when test="$original_tag != ''">
- <xsl:value-of select="$original_tag" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$defaultElement" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$elementName}" namespace="http://www.w3.org/1999/xhtml">
- <xsl:if test="@id">
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@role" />
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="*[@role='RHC.DUMMY']" priority="2">
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template name="RHC.Role">
- <xsl:param name="rolestr" />
- <xsl:if test="substring($rolestr,1,4) = 'RHC.'">
- <xsl:variable name="rhcrole" select="substring($rolestr, 5)" />
- <xsl:choose>
- <xsl:when test="contains($rhcrole,'\')">
- <xsl:if test="substring-before($rhcrole, '\')">
- <xsl:attribute name="class">
- <xsl:value-of select="substring-before($rhcrole, '\')" />
- </xsl:attribute>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$rhcrole">
- <xsl:attribute name="class">
- <xsl:value-of select="$rhcrole" />
- </xsl:attribute>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="graphic[starts-with(@role, 'RHC') and (substring-after(@role, '\') = 'hr')]">
- <hr xmlns="http://www.w3.org/1999/xhtml">
- <xsl:if test="@align">
- <xsl:attribute name="align">
- <xsl:value-of select="@align" />
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@width">
- <xsl:attribute name="width">
- <xsl:value-of select="@width" />
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@depth">
- <xsl:attribute name="size">
- <xsl:value-of select="@depth" />
- </xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="@role" />
- </hr>
- </xsl:template>
-
- <xsl:template name="rhc.longdesc.uri">
- <xsl:param name="mediaobject" select="."/>
-
- <xsl:if test="$html.longdesc">
- <xsl:if test="$mediaobject/textobject[not(phrase)]">
- <xsl:variable name="image-id">
- <xsl:call-template name="object.id">
- <xsl:with-param name="object" select="$mediaobject"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="concat('ld-',$image-id)"/>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="rhc.write.longdesc">
- <xsl:param name="mediaobject" select="."/>
- <xsl:param name="longdesc.id" select="''"/>
- <xsl:if test="$html.longdesc != 0 and $mediaobject/textobject[not(phrase)]">
- <div xmlns="http://www.w3.org/1999/xhtml" border="1">
- <br xmlns="http://www.w3.org/1999/xhtml" clear="all" />
- <br xmlns="http://www.w3.org/1999/xhtml"/>
- <xsl:attribute name="id">
- <xsl:value-of select="$longdesc.id" />
- </xsl:attribute>
- <xsl:for-each select="$mediaobject/textobject[not(phrase)]">
- <xsl:apply-templates select="./*"/>
- </xsl:for-each>
- </div>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="beginpage" />
-
- <xsl:template match="replaceable[substring(@role, 1, 4) = 'RHC.']" priority="1">
- <xsl:variable name="original_tag" select="normalize-space(substring-after(@role, '\'))" />
- <xsl:variable name="elementName">
- <xsl:choose>
- <xsl:when test="$original_tag != ''">
- <xsl:value-of select="$original_tag" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'span'" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$elementName}" namespace="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="@role" />
- <xsl:apply-templates />
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="simpara[substring(@role, 1, 4) = 'RHC.']">
- <xsl:variable name="original_tag" select="normalize-space(substring-after(@role, '\'))" />
- <xsl:variable name="elementName">
- <xsl:choose>
- <xsl:when test="$original_tag != ''">
- <xsl:value-of select="$original_tag" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'span'" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:element name="{$elementName}" namespace="http://www.w3.org/1999/xhtml">
- <xsl:apply-templates select="@role" />
- <xsl:apply-templates />
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="calloutlist[substring(@role, 1, 4) = 'RHC.']" priority="1" />
-
- </xsl:stylesheet>
-